Repository navigation
Fix Roc client wire semantics - #12475
Conversation
Roc now emits original JSON wire keys and values, omits absent optional arguments, encodes empty arguments as {}, and propagates daemon and tool errors. Include MCPX_RUN and bearer auth in requests. The dry-run regression caught that omitting x-mcpx-run lets a dispatched Roc call lack the run identity needed for safe interception.
Resolve Roc through a flake devshell when it is unavailable on the host PATH.
Closes #12466
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 20 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 92c6b57394
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| for _, want := range []string{"import pf.Http", "import pf.Env", "import http.Request", "TransportError(Str)", "StatusError(U16)", "DaemonError(Str)", "ToolResultError(Str)", "Try(Response.Response, ToolError)", "name : Str", "count : I64", "Http.send!(authenticated_request, {})", "x-mcpx-session", "x-mcpx-run", "MCPX_RUN", "Authorization", "Bearer", "demo_say_hi! = |args|", `Json.to_str_try("say-hi")`, `Json.to_str_try("demo-server")`, "isError ?: Bool", "List.keep_oks(content, |block| block.?text)", "Response.body", "Json.parse", "MCPX_TRANSPORT_BEARER_TOKEN", `\"next-page\"`, `raw ?: a`, "a.Json.Encodable(_)"} { | ||
| if !strings.Contains(out, want) { | ||
| t.Errorf("Roc client missing %q:\n%s", want, out) | ||
| } |
There was a problem hiding this comment.
Add property-based coverage for the wire serialization invariants
The new hand-built argument serializer has explicit invariants—preserve original property names and values, omit absent optional fields, and encode empty arguments as {}—but these checks only inspect generated source substrings. The compiler smoke test and single x: "world" mock-daemon case do not establish those invariants across inputs. This violates the testing doctrine in AGENTS.md, which requires property-based tests for invariant-bearing code, including serializers. Add generated schemas/arguments and use decoded requests observed by the mock daemon as the oracle, covering escaping, sanitization collisions, and optional-field presence.
AGENTS.md reference: AGENTS.md:L36-L39
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Added TestRocWireSerializationProperties in runner tests. It builds 16 seeded Roc tool schemas with collision-prone/reserved/quoted wire keys and generated requiredness/argument values, runs one Roc process against a mock daemon, and compares each decoded JSON request to the expected server/tool/args. The fixed cases guarantee all optional fields omitted once and all present once; remaining schemas vary requiredness/presence. Verified with the focused runner tests and go test -race -shuffle=on -count=5 -run Roc ./internal/runner (pass). Commit: 25c4342.
Summary
{}for tools with no arguments.MCPX_RUN; propagate daemon and tool-level errors.The mock-daemon regression exposed the safety gap: without
x-mcpx-run, the request cannot be intercepted as a dry-run call. Roc now sends that identity like the other generated clients.Verification
cd pkgs/mcpx && go test -count=1 ./internal/api ./internal/codegen ./internal/runnercd pkgs/mcpx && go test -race -shuffle=on -count=5 -run 'Roc' ./internal/codegen ./internal/runner2026-11-13-03dce41andbasic-cli 0.28.1.Closes #12466